package com.zzw.design.observer;

import java.util.HashMap;
import java.util.Map;

public class WriterManger {

	public Map<String,Writer> map = new HashMap<String, Writer>();
	
	public void add(Writer writer){
		map.put(writer.getName(), writer);
	}
	
	public Writer getWriter(String name){
		return map.get(name);
	}

    private WriterManger(){}
    
    public static WriterManger getInstance(){
        return WriterManagerInstance.instance;
    }
    
    private static class WriterManagerInstance{
        private static WriterManger instance = new WriterManger();
    }
}